package part11;

import java.util.*;

/**
 * @author wcj
 * @Date 2021/5/20 17:01
 * @Version 1.0
 */
public class Part115 {

    public static Collection fill(Collection<String> collection) {
        collection.add("rat");
        collection.add("cat");
        collection.add("dog");
        collection.add("dog");
        return collection;
    }

    public static Map fill(Map<String, String> m) {
        m.put("rat", "Fuzzy");
        m.put("cat", "Rags");
        m.put("dog", "Bosco");
        m.put("dog", "Spot");
        return m;
    }

    /**
     * 容器类中都提供了很好的toString函数便于输出，不像数组我们需要使用Arrays.toString()进行输出
     *
     * @param args
     */
    public static void main(String[] args) {
        System.out.println(fill(new ArrayList<String>()));
        System.out.println(fill(new LinkedList<String>()));
        System.out.println(fill(new HashSet<String>()));
        System.out.println(fill(new TreeSet<String>()));
        System.out.println(fill(new LinkedHashSet<String>()));
        System.out.println(fill(new HashMap<String, String>()));
        System.out.println(fill(new TreeMap<String, String>()));
        System.out.println(fill(new LinkedHashMap<String, String>()));
    }
}
